import { http } from '@/utils/http'
import type { ClassRoomItem } from '@/types/classRoom'
import type { PageParams, PageResult } from '@/types/global'

/**
 * 获取班级列表
 * @param params
 * @returns
 */
export const getClassRoomListAPI = (params: PageParams) => {
  return http<PageResult<ClassRoomItem>>({
    method: 'GET',
    url: '/wechat/classRoom/list',
    data: params,
  })
}

/**
 * 获取班级详情
 * @param id
 * @returns
 */
export const getClassRoomDetailAPI = (id: number) => {
  return http<ClassRoomItem>({
    method: 'GET',
    url: `/wechat/classRoom/${id}`,
  })
}

/**
 * 添加班级
 * @param data
 * @returns
 */
export const addClassRoomAPI = (data: ClassRoomItem) => {
  return http<ClassRoomItem>({
    method: 'POST',
    url: '/wechat/classRoom/add',
    data,
  })
}

/**
 * 更新班级
 * @param id
 * @param data
 * @returns
 */
export const updateClassRoomAPI = (data: Partial<ClassRoomItem>) => {
  return http<ClassRoomItem>({
    method: 'POST',
    url: `/wechat/classRoom/update`,
    data,
  })
}
